## Load objects with the posterior distributions using non-informative priors

load(here("final_analyses", "output", "data",
                 "noninformative_recovery_discharge.RData"))

## Load objects with rma() outputs for forest plots

load(here("final_analyses", "output", "data",
                 "priors_discharge.RData"))

## Load objects with mean + SD of multiple priors along with
## RECOVERY data and posterior distributions

load(file = here("final_analyses", "output", "data",
                 "multiple_priors_discharge.RData"))

## Load objets with all the posterior for summary plot

load(here("final_analyses", "output", "data",
                 "all_posteriors_discharge.RData"))
## Load functions to plot

# To create summary table

source(here("final_analyses", "script", "functions", # file path
            "summary_table_discharge.R"))            # file name


# To plot risk distributions side-by-side

source(here("final_analyses", "script", "functions", # file path
            "risk_comparison_plot.R"))               # file name

# To plot risk difference distribution

source(here("final_analyses", "script", "functions", # file path
            "risk_difference_plot.R"))               # file name

# To plot cumulative probability of risk difference

source(here("final_analyses", "script", "functions", # file path
            "cumulative_risk_difference_plot.R"))    # file name

# To plot prior, data and posterior distributions side-by-side

source(here("final_analyses", "script", "functions", # file path
            "data_prior_posterior_plot.R"))          # file name

# To plot the posterior distribution

source(here("final_analyses", "script", "functions", # file path
            "posterior_difference_plot.R"))          # file name

# To plot the cumulative probability of a posterior distribution

source(here("final_analyses", "script", "functions", # file path
            "posterior_cumulative_plot.R"))          # file name

Summary

As stated in our pre-registered protocol, the skeptical prior uses the evidence-based prior (EBP)’s variance, but the mean equals \(0\). The optimistic prior uses the EBP’s variance, but the mean equals \(0.05\). Lastly, the pessimistic prior uses the EBP’s variance, but the mean equals \(-0.05\).


Regarding this outcome, positive risk differences mean benefit.

# X axis
xlim_inf = -7.5
xlim_sup = 12.5
ticks_spacing = 2.5

# Assure subgroup order
# https://stackoverflow.com/questions/12774210/
# how-do-you-specifically-order-ggplot2-x-axis-instead-of-alphabetical-order

level_order = c("Pessimistic",
                "Optimistic",
                "Skeptical",
                "Evidence-based",
                "Non-informative")

p1 = all_posteriors_simple_oxygen_discharge %>%
  
  # make it tidy for ggplot
  pivot_longer(
    cols = c("Non-informative":"Pessimistic"),
    names_to = "dist", values_to = "samples"
  ) %>%
  
  ggplot(aes(x = 100 * samples, y = factor(dist, level = level_order))) +

  # https://mjskay.github.io/ggdist/articles/slabinterval.html
  stat_halfeye(aes(fill = stat(x > 0)),
               .width = c(0.5, 0.95)
  ) +
  scale_fill_manual(values = c("gray90", "skyblue")) +
  labs(x = "\nRisk difference (%)",
       y = "Underlying prior\n",
       title = "Simple oxygen only subgroup\n"
  ) +
  scale_x_continuous(breaks = seq(from = xlim_inf, to = xlim_sup, ticks_spacing)) +
  scale_y_discrete(expand = c(0, 0.3)) +
  theme(
    axis.ticks.x = element_blank(),
    axis.ticks.y = element_blank(),
    panel.background = element_blank(),
    panel.grid.major.x = element_line(color = "gray80", size = 0.3),
    legend.position = "none",
    plot.title.position = 'plot',
    plot.margin = margin(20, 25, 10, 20)
  ) +
  coord_cartesian(xlim = c(xlim_inf, xlim_sup))
p2 = all_posteriors_noninvasive_discharge %>%
  
  # make it tidy for ggplot
  pivot_longer(
    cols = c("Non-informative":"Pessimistic"),
    names_to = "dist", values_to = "samples"
  ) %>%
  
  ggplot(aes(x = 100 * samples, y = factor(dist, level = level_order))) +

  # https://mjskay.github.io/ggdist/articles/slabinterval.html
  stat_halfeye(aes(fill = stat(x > 0)),
               .width = c(0.5, 0.95)
  ) +
  scale_fill_manual(values = c("gray90", "forestgreen")) +
  labs(x = "\nRisk difference (%)",
       y = "Underlying prior\n",
       title = "Non-invasive ventilation subgroup\n"
  ) +
  scale_x_continuous(breaks = seq(from = xlim_inf, to = xlim_sup, ticks_spacing)) +
  scale_y_discrete(expand = c(0, 0.3)) +
  theme(
    axis.ticks.x = element_blank(),
    axis.ticks.y = element_blank(),
    panel.background = element_blank(),
    panel.grid.major.x = element_line(color = "gray80", size = 0.3),
    legend.position = "none",
    plot.title.position = 'plot',
    plot.margin = margin(20, 25, 10, 20)
  ) +
  coord_cartesian(xlim = c(xlim_inf, xlim_sup))
p3 = all_posteriors_invasive_discharge %>%
  
  # make it tidy for ggplot
  pivot_longer(
    cols = c("Non-informative":"Pessimistic"),
    names_to = "dist", values_to = "samples"
  ) %>%
  
  ggplot(aes(x = 100 * samples, y = factor(dist, level = level_order))) +

  # https://mjskay.github.io/ggdist/articles/slabinterval.html
  stat_halfeye(aes(fill = stat(x > 0)),
               .width = c(0.5, 0.95)
  ) +
  scale_fill_manual(values = c("gray90", "firebrick")) +
  labs(x = "\nRisk difference (%)",
       y = "Underlying prior\n",
       title = "Invasive mechanical ventilation subgroup\n"
  ) +
  scale_x_continuous(breaks = seq(from = xlim_inf, to = xlim_sup, ticks_spacing)) +
  scale_y_discrete(expand = c(0, 0.3)) +
  theme(
    axis.ticks.x = element_blank(),
    axis.ticks.y = element_blank(),
    panel.background = element_blank(),
    panel.grid.major.x = element_line(color = "gray80", size = 0.3),
    legend.position = "none",
    plot.title.position = 'plot',
    plot.margin = margin(20, 25, 10, 20)
  ) +
  coord_cartesian(xlim = c(xlim_inf, xlim_sup))
p1 + plot_annotation(title = "Posterior distributions on hospital discharge",
                          theme = theme(plot.title = element_text(size = 20)))
Interval bars depict 50% and 95% credible intervals

Interval bars depict 50% and 95% credible intervals

# Summary table
table_posterior = summary_table_discharge(all_posteriors_simple_oxygen_discharge)

# Use kableExtra to have a nice table

table_posterior %>% 
  kbl(booktabs = T, align = 'c') %>% 
  kable_styling(bootstrap_options = "striped", full_width = F) %>% 
  column_spec(7, bold = T, color = "#5891BF") %>%
  add_header_above(c(" " = 3,
                     "Probability of Harm" = 3,
                     "Probability of Benefit" = 4)) %>% 
  footnote(general = "RD = Risk Difference; SD = Standard Deviation")
Probability of Harm
Probability of Benefit
Prior Mean RD SD Pr(< -5%) Pr(< -2%) Pr(< -1%) Pr(> 0%) Pr(> 1%) Pr(> 2%) Pr(> 5%)
Non-informative 0.065 0.021 0 0 0 100 100 98 76
Evidence-based 0.066 0.019 0 0 0 100 100 99 79
Skeptical 0.056 0.019 0 0 0 100 99 97 62
Optimistic 0.063 0.019 0 0 0 100 100 99 75
Pessimistic 0.049 0.019 0 0 0 99 98 93 47
Note:
RD = Risk Difference; SD = Standard Deviation
p2
Interval bars depict 50% and 95% credible intervals

Interval bars depict 50% and 95% credible intervals

# Summary table
table_posterior = summary_table_discharge(all_posteriors_noninvasive_discharge)

# Use kableExtra to have a nice table

table_posterior %>% 
  kbl(booktabs = T, align = 'c') %>% 
  kable_styling(bootstrap_options = "striped", full_width = F) %>% 
  column_spec(7, bold = T, color = "forestgreen") %>%
  add_header_above(c(" " = 3,
                     "Probability of Harm" = 3,
                     "Probability of Benefit" = 4)) %>%  
  footnote(general = "RD = Risk Difference; SD = Standard Deviation")
Probability of Harm
Probability of Benefit
Prior Mean RD SD Pr(< -5%) Pr(< -2%) Pr(< -1%) Pr(> 0%) Pr(> 1%) Pr(> 2%) Pr(> 5%)
Non-informative 0.072 0.024 0 0 0 100 99 98 82
Evidence-based 0.065 0.022 0 0 0 100 99 98 75
Skeptical 0.062 0.022 0 0 0 100 99 97 70
Optimistic 0.069 0.022 0 0 0 100 100 99 80
Pessimistic 0.055 0.022 0 0 0 99 98 94 59
Note:
RD = Risk Difference; SD = Standard Deviation
p3
Interval bars depict 50% and 95% credible intervals.

Interval bars depict 50% and 95% credible intervals.

# Summary table
table_posterior = summary_table_discharge(all_posteriors_invasive_discharge)

# Use kableExtra to have a nice table

table_posterior %>% 
  kbl(booktabs = T, align = 'c') %>% 
  kable_styling(bootstrap_options = "striped", full_width = F) %>% 
  column_spec(7, bold = T, color = "firebrick") %>%
  add_header_above(c(" " = 3,
                     "Probability of Harm" = 3,
                     "Probability of Benefit" = 4)) %>% 
  footnote(general = "RD = Risk Difference; SD = Standard Deviation")
Probability of Harm
Probability of Benefit
Prior Mean RD SD Pr(< -5%) Pr(< -2%) Pr(< -1%) Pr(> 0%) Pr(> 1%) Pr(> 2%) Pr(> 5%)
Non-informative 0.034 0.032 0 5 9 85 77 67 31
Evidence-based 0.041 0.029 0 2 4 92 85 76 38
Skeptical 0.029 0.029 0 5 9 84 74 62 23
Optimistic 0.037 0.029 0 3 6 89 82 71 33
Pessimistic 0.020 0.029 1 9 15 75 64 50 15
Note:
RD = Risk Difference; SD = Standard Deviation

Per subgroup

Simple oxygen only

Non-informative prior

## Plot!

# I will use my own functions to standardize my plots

risk_comparison_plot(
  noninformative_recovery_simple_oxygen_discharge, # Data object

  ### start using quotes
  
  "gray50", # Color code for control group
  "#5C87C3", # Color code for other group
  "\nRisk (%)", # X axis label
  "RECOVERY trial", # Title
  "Simple oxygen only subgroup\n", # Subtitle
  
  ### stop using quotes

  58, # X axis inferior limit
  78, # X axis superior limit
  2 # X axis spacing for ticks
)
While the darker shaded area depicts the 50% credible interval (CI), the interval bar depicts the 95% CI.

While the darker shaded area depicts the 50% credible interval (CI), the interval bar depicts the 95% CI.

xlabel = "\nRisk difference (%)"
xlim_inf = -2
xlim_sup = 14

p1 = risk_difference_plot(
  noninformative_recovery_simple_oxygen_discharge, # Data object

  ## start using quotes
  "#9D95C6", # fill color code
  xlabel, # X axis label
  ### stop using quotes

  xlim_inf, # X axis inferior limit
  xlim_sup, # X axis superior limit
  2 # X axis label
) 

p2 = cumulative_risk_difference_plot(
  noninformative_recovery_simple_oxygen_discharge, # Data object
  xlabel, # X axis label (in quotes)
  xlim_inf, # X axis inferior limit
  xlim_sup, # X axis superior limit
  1, # Spacing between ticks in X axis
  "discharge" # Outcome (within quotes)
  )
p1 + p2 + plot_annotation(
  title = "Posterior distribution: RECOVERY trial + Non-informative prior",
  subtitle = "Risk difference between groups on simple oxygen only"
)
The interval bar depicts the 95% credible interval. The cumulative posterior distribution corresponds to the probabilities that the risk difference (RD) is greater than or equal to the effect size on the X‐axis.

The interval bar depicts the 95% credible interval. The cumulative posterior distribution corresponds to the probabilities that the risk difference (RD) is greater than or equal to the effect size on the X‐axis.

Evidence-based prior

forest(priors_simple_oxygen_discharge)

xlabel = "\nRisk difference (%)"

data_prior_posterior_plot(
  multiple_priors_simple_oxygen_discharge %>% # Output from normal_approximation()
    filter(type == "evidence-based"), 
  
  # start using quotes
           "#364D55", # Color for the prior
           "#9D95C6", # Color for RECOVERY
           "#DBA237", # Color for the posterior
           xlabel, # X axis label
           "Posterior distribution: RECOVERY + Evidence-based prior", # Title
           "Simple oxygen only subgroup", # Subtitle
           # stop using quotes
           -10, # X axis inferior limit
           20, # X axis superior limit
           5 # Spacing between ticks in X axis
  ) 
While the darker shaded area depicts the 50% credible interval (CI), the interval bar depicts the 95% CI.

While the darker shaded area depicts the 50% credible interval (CI), the interval bar depicts the 95% CI.

xlim_inf = 0
xlim_sup = 14

p1 = posterior_difference_plot(
  multiple_priors_simple_oxygen_discharge %>% # Output from normal_approximation()
    filter(type == "evidence-based"), 

  ## start using quotes
  "#DBA237", # fill color code
  xlabel, # X axis label
  ### stop using quotes

  xlim_inf, # X axis inferior limit
  xlim_sup, # X axis superior limit
  2 # Spacing between ticks in X axis
) 

p2 = posterior_cumulative_plot(
  multiple_priors_simple_oxygen_discharge %>% # Output from normal_approximation()
    filter(type == "evidence-based"), 
  xlabel, # X axis label (in quotes)
  xlim_inf, # X axis inferior limit
  xlim_sup, # X axis superior limit
  1, # Spacing between ticks in X axis
  "discharge" # Outcome (within quotes)
  )
p1 + p2 + plot_annotation(
  title = "Posterior distribution: RECOVERY trial + Evidence-based prior",
  subtitle = "Simple oxygen only subgroup"
)
The interval bar depicts the 95% credible interval. The cumulative posterior distribution corresponds to the probabilities that the risk difference (RD) is greater than or equal to the effect size on the X‐axis.

The interval bar depicts the 95% credible interval. The cumulative posterior distribution corresponds to the probabilities that the risk difference (RD) is greater than or equal to the effect size on the X‐axis.

Skeptical prior

xlabel = "\nRisk difference (%)"

data_prior_posterior_plot(
  
  # Output from normal_approximation_multiple_priors()
  multiple_priors_simple_oxygen_discharge %>%
    filter(type == "skeptical"), 
  
  # start using quotes
           "gray60", # Color for the prior
           "#9D95C6", # Color for RECOVERY
           "#DBA237", # Color for the posterior
           xlabel, # X axis label
           "Posterior distribution: RECOVERY trial + Skeptical prior", # Title
           "Simple oxygen only subgroup", # Subtitle
           # stop using quotes
           -15, # X axis inferior limit
           15, # X axis superior limit
           5 # Spacing between ticks in X axis
  ) 
While the darker shaded area depicts the 50% credible interval (CI), the interval bar depicts the 95% CI.

While the darker shaded area depicts the 50% credible interval (CI), the interval bar depicts the 95% CI.

xlim_inf = 0
xlim_sup = 12

p1 = posterior_difference_plot(
  
  multiple_priors_simple_oxygen_discharge %>% # Output from normal_approximation()
    filter(type == "skeptical"), 

  ## start using quotes
  "gray50", # fill color code
  xlabel, # X axis label
  ### stop using quotes

  xlim_inf, # X axis inferior limit
  xlim_sup, # X axis superior limit
  2 # Spacing between ticks in X axis
) 

p2 = posterior_cumulative_plot(
  
  multiple_priors_simple_oxygen_discharge %>% # Output from normal_approximation()
    filter(type == "skeptical"), 
  
  xlabel, # X axis label (in quotes)
  xlim_inf, # X axis inferior limit
  xlim_sup, # X axis superior limit
  1, # Spacing between ticks in X axis
  "discharge" # Outcome (within quotes)
  )
p1 + p2 + plot_annotation(
  title = "Posterior distribution: RECOVERY trial + Skeptical prior",
  subtitle = "Simple oxygen only subgroup"
)
The interval bar depicts the 95% credible interval. The cumulative posterior distribution corresponds to the probabilities that the risk difference (RD) is greater than or equal to the effect size on the X‐axis.

The interval bar depicts the 95% credible interval. The cumulative posterior distribution corresponds to the probabilities that the risk difference (RD) is greater than or equal to the effect size on the X‐axis.

Optimistic prior

xlabel = "\nRisk difference (%)"

data_prior_posterior_plot(
  
  # Output from normal_approximation_multiple_priors()
  multiple_priors_simple_oxygen_discharge %>%
    filter(type == "optimistic"), 
  
  # start using quotes
  "#5CA881", # Color for the prior
  "#9D95C6", # Color for RECOVERY
  "#DBA237", # Color for the posterior
  xlabel, # X axis label
  "Posterior distribution: RECOVERY trial + Optimistic prior", # Title
  "Simple oxygen only subgroup", # Subtitle
  # stop using quotes
  -10, # X axis inferior limit
  20, # X axis superior limit
  5 # Spacing between ticks in X axis
) 
While the darker shaded area depicts the 50% credible interval (CI), the interval bar depicts the 95% CI.

While the darker shaded area depicts the 50% credible interval (CI), the interval bar depicts the 95% CI.

xlim_inf = 0
xlim_sup = 14

p1 = posterior_difference_plot(
  
  multiple_priors_simple_oxygen_discharge %>% # Output from normal_approximation()
    filter(type == "optimistic"), 
  
  ## start using quotes
  "#5CA881", # fill color code
  xlabel, # X axis label
  ### stop using quotes
  
  xlim_inf, # X axis inferior limit
  xlim_sup, # X axis superior limit
  2 # Spacing between ticks in X axis
) 

p2 = posterior_cumulative_plot(
  
  multiple_priors_simple_oxygen_discharge %>% # Output from normal_approximation()
    filter(type == "optimistic"), 
  
  xlabel, # X axis label (in quotes)
  xlim_inf, # X axis inferior limit
  xlim_sup, # X axis superior limit
  1, # Spacing between ticks in X axis
  "discharge" # Outcome (within quotes)
)
p1 + p2 + plot_annotation(
  title = "Posterior distribution: RECOVERY trial + Optimistic prior",
  subtitle = "Simple oxygen only subgroup"
)
The interval bar depicts the 95% credible interval. The cumulative posterior distribution corresponds to the probabilities that the risk difference (RD) is greater than or equal to the effect size on the X‐axis.

The interval bar depicts the 95% credible interval. The cumulative posterior distribution corresponds to the probabilities that the risk difference (RD) is greater than or equal to the effect size on the X‐axis.

Pessimistic prior

xlabel = "\nRisk difference (%)"

data_prior_posterior_plot(
  
  # Output from normal_approximation_multiple_priors()
  multiple_priors_simple_oxygen_discharge %>%
    filter(type == "pessimistic"), 
  
  # start using quotes
  "#523C84", # Color for the prior
  "#9D95C6", # Color for RECOVERY
  "#DBA237", # Color for the posterior
  xlabel, # X axis label
  "Posterior distribution: RECOVERY trial + Pessimistic prior", # Title
  "Simple oxygen only subgroup", # Subtitle
  # stop using quotes
  -20, # X axis inferior limit
  15, # X axis superior limit
  5 # Spacing between ticks in X axis
) 
While the darker shaded area depicts the 50% credible interval (CI), the interval bar depicts the 95% CI.

While the darker shaded area depicts the 50% credible interval (CI), the interval bar depicts the 95% CI.

xlim_inf = 0
xlim_sup = 12

p1 = posterior_difference_plot(
  
  multiple_priors_simple_oxygen_discharge %>% # Output from normal_approximation()
    filter(type == "pessimistic"), 
  
  ## start using quotes
  "#523C84", # fill color code
  xlabel, # X axis label
  ### stop using quotes
  
  xlim_inf, # X axis inferior limit
  xlim_sup, # X axis superior limit
  2 # Spacing between ticks in X axis
) 

p2 = posterior_cumulative_plot(
  
  multiple_priors_simple_oxygen_discharge %>% # Output from normal_approximation()
    filter(type == "pessimistic"), 
  
  xlabel, # X axis label (in quotes)
  xlim_inf, # X axis inferior limit
  xlim_sup, # X axis superior limit
  1, # Spacing between ticks in X axis
  "discharge" # Outcome (within quotes)
)
p1 + p2 + plot_annotation(
  title = "Posterior distribution: RECOVERY trial + Pessimistic prior",
  subtitle = "Simple oxygen only subgroup"
)
The interval bar depicts the 95% credible interval. The cumulative posterior distribution corresponds to the probabilities that the risk difference (RD) is greater than or equal to the effect size on the X‐axis.

The interval bar depicts the 95% credible interval. The cumulative posterior distribution corresponds to the probabilities that the risk difference (RD) is greater than or equal to the effect size on the X‐axis.

Non-invasive ventilation

Non-informative prior

## Plot!

# I will be using my own functions to standardize my plots

risk_comparison_plot(
  noninformative_recovery_non_invasive_discharge, # Output from normal_approximation()

  ### start using quotes
  
  "gray50", # Color code for control group
  "#5C87C3", # Color code for other group
  "\nRisk (%)", # X axis label
  "RECOVERY trial", # Title
  "Non-invasive ventilation subgroup\n", # Subtitle
  
  ### stop using quotes

  32, # X axis inferior limit
  54, # X axis superior limit
  2 # Spacing between ticks in X axis
)
While the darker shaded area depicts the 50% credible interval (CI), the interval bar depicts the 95% CI.

While the darker shaded area depicts the 50% credible interval (CI), the interval bar depicts the 95% CI.

xlabel = "\nRisk difference (%)"
xlim_inf = -2
xlim_sup = 16

p1 = risk_difference_plot(
  noninformative_recovery_non_invasive_discharge, # Data object

  ## start using quotes
  "#9D95C6", # fill color code
  xlabel, # X axis label
  ### stop using quotes

  xlim_inf, # X axis inferior limit
  xlim_sup, # X axis superior limit
  2 # Spacing between ticks in X axis
) 

p2 = cumulative_risk_difference_plot(
  noninformative_recovery_non_invasive_discharge, # Data object
  xlabel, # X axis label (in quotes)
  xlim_inf, # X axis inferior limit
  xlim_sup, # X axis superior limit
  1, # Spacing between ticks in X axis
  "discharge" # Outcome (within quotes)
  )
p1 + p2 + plot_annotation(
  title = "Posterior distribution: RECOVERY trial + Non-informative prior",
  subtitle = "Risk difference between groups on non-invasive ventilation"
)
The interval bar depicts the 95% credible interval. The cumulative posterior distribution corresponds to the probabilities that the risk difference (RD) is greater than or equal to the effect size on the X‐axis.

The interval bar depicts the 95% credible interval. The cumulative posterior distribution corresponds to the probabilities that the risk difference (RD) is greater than or equal to the effect size on the X‐axis.

Evidence-based prior

forest(priors_noninvasive_discharge)

data_prior_posterior_plot(
   multiple_priors_noninvasive_discharge %>%
    filter(type == "evidence-based"), # Output from normal_approximation()
  
  # start using quotes
           "#364D55", # Color for the prior
           "#9D95C6", # Color for RECOVERY
           "#DBA237", # Color for the posterior
           xlabel, # X axis label
           "Posterior distribution: RECOVERY + Evidence-based prior", # Title
           "Non-invasive ventilation subgroup", # Subtitle
           # stop using quotes
           -10, # X axis inferior limit
           15, # X axis superior limit
           5 # Spacing between ticks in X axis
  ) 
While the darker shaded area depicts the 50% credible interval (CI), the interval bar depicts the 95% CI.

While the darker shaded area depicts the 50% credible interval (CI), the interval bar depicts the 95% CI.

xlim_inf = -2
xlim_sup = 14

p1 = posterior_difference_plot(
  multiple_priors_noninvasive_discharge %>% # Output from normal_approximation()
    filter(type == "evidence-based"), 

  ## start using quotes
  "#DBA237", # fill color code
  xlabel, # X axis label
  ### stop using quotes

  xlim_inf, # X axis inferior limit
  xlim_sup, # X axis superior limit
  2 # Spacing between ticks in X axis
) 

p2 = posterior_cumulative_plot(
  multiple_priors_noninvasive_discharge %>% # Output from normal_approximation()
    filter(type == "evidence-based"), 
  xlabel, # X axis label (in quotes)
  xlim_inf, # X axis inferior limit
  xlim_sup, # X axis superior limit
  1, # Spacing between ticks in X axis
  "discharge" # Outcome (within quotes)
  )
p1 + p2 + plot_annotation(
  title = "Posterior distribution: RECOVERY trial + Evidence-based prior",
  subtitle = "Non-invasive ventilation subgroup"
)
The interval bar depicts the 95% credible interval. The cumulative posterior distribution corresponds to the probabilities that the risk difference (RD) is greater than or equal to the effect size on the X‐axis.

The interval bar depicts the 95% credible interval. The cumulative posterior distribution corresponds to the probabilities that the risk difference (RD) is greater than or equal to the effect size on the X‐axis.

Skeptical prior

xlabel = "\nRisk difference (%)"

data_prior_posterior_plot(
  
  # Output from normal_approximation_multiple_priors()
  multiple_priors_noninvasive_discharge %>%
    filter(type == "skeptical"), 
  
  # start using quotes
           "gray60", # Color for the prior
           "#9D95C6", # Color for RECOVERY
           "#DBA237", # Color for the posterior
           xlabel, # X axis label
           "Posterior distribution: RECOVERY trial + Skeptical prior", # Title
           "Non-invasive ventilation subgroup", # Subtitle
           # stop using quotes
           -15, # X axis inferior limit
           15, # X axis superior limit
           5 # Spacing between ticks in X axis
  ) 
While the darker shaded area depicts the 50% credible interval (CI), the interval bar depicts the 95% CI.

While the darker shaded area depicts the 50% credible interval (CI), the interval bar depicts the 95% CI.

xlim_inf = -2
xlim_sup = 12

p1 = posterior_difference_plot(
  
  multiple_priors_noninvasive_discharge %>% # Output from normal_approximation_multiple_priors()
    filter(type == "skeptical"), 

  ## start using quotes
  "gray50", # fill color code
  xlabel, # X axis label
  ### stop using quotes

  xlim_inf, # X axis inferior limit
  xlim_sup, # X axis superior limit
  2 # Spacing between ticks in X axis
) 

p2 = posterior_cumulative_plot(
  
  multiple_priors_noninvasive_discharge %>% # Output from normal_approximation_multiple_priors()
    filter(type == "skeptical"), 
  
  xlabel, # X axis label (in quotes)
  xlim_inf, # X axis inferior limit
  xlim_sup, # X axis superior limit
  1, # Spacing between ticks in X axis
  "discharge" # Outcome (within quotes)
  )
p1 + p2 + plot_annotation(
  title = "Posterior distribution: RECOVERY trial + Skeptical prior",
  subtitle = "Non-invasive ventilation subgroup"
)
The interval bar depicts the 95% credible interval. The cumulative posterior distribution corresponds to the probabilities that the risk difference (RD) is greater than or equal to the effect size on the X‐axis.

The interval bar depicts the 95% credible interval. The cumulative posterior distribution corresponds to the probabilities that the risk difference (RD) is greater than or equal to the effect size on the X‐axis.

Optimistic prior

xlabel = "\nRisk difference (%)"

data_prior_posterior_plot(
  
  # Output from normal_approximation_multiple_priors()
  multiple_priors_noninvasive_discharge %>%
    filter(type == "optimistic"), 
  
  # start using quotes
  "#5CA881", # Color for the prior
  "#9D95C6", # Color for RECOVERY
  "#DBA237", # Color for the posterior
  xlabel, # X axis label
  "Posterior distribution: RECOVERY trial + Optimistic prior", # Title
  "Non-invasive ventilation subgroup", # Subtitle
  # stop using quotes
  -10, # X axis inferior limit
  20, # X axis superior limit
  5 # Spacing between ticks in X axis
) 
While the darker shaded area depicts the 50% credible interval (CI), the interval bar depicts the 95% CI.

While the darker shaded area depicts the 50% credible interval (CI), the interval bar depicts the 95% CI.

xlim_inf = 0
xlim_sup = 14

p1 = posterior_difference_plot(
  
  multiple_priors_noninvasive_discharge %>% # Output from normal_approximation_multiple_priors()
    filter(type == "optimistic"), 
  
  ## start using quotes
  "#5CA881", # fill color code
  xlabel, # X axis label
  ### stop using quotes
  
  xlim_inf, # X axis inferior limit
  xlim_sup, # X axis superior limit
  2 # Spacing between ticks in X axis
) 

p2 = posterior_cumulative_plot(
  
  multiple_priors_noninvasive_discharge %>% # Output from normal_approximation_multiple_priors()
    filter(type == "optimistic"), 
  
  xlabel, # X axis label (in quotes)
  xlim_inf, # X axis inferior limit
  xlim_sup, # X axis superior limit
  1, # Spacing between ticks in X axis
  "discharge" # Outcome (within quotes)
)
p1 + p2 + plot_annotation(
  title = "Posterior distribution: RECOVERY trial + Optimistic prior",
  subtitle = "Non-invasive ventilation subgroup"
)
The interval bar depicts the 95% credible interval. The cumulative posterior distribution corresponds to the probabilities that the risk difference (RD) is greater than or equal to the effect size on the X‐axis.

The interval bar depicts the 95% credible interval. The cumulative posterior distribution corresponds to the probabilities that the risk difference (RD) is greater than or equal to the effect size on the X‐axis.

Pessimistic prior

xlabel = "\nRisk difference (%)"

data_prior_posterior_plot(
  
  # Output from normal_approximation_multiple_priors()
  multiple_priors_noninvasive_discharge %>%
    filter(type == "pessimistic"), 
  
  # start using quotes
  "#523C84", # Color for the prior
  "#9D95C6", # Color for RECOVERY
  "#DBA237", # Color for the posterior
  xlabel, # X axis label
  "Posterior distribution: RECOVERY trial + Pessimistic prior", # Title
  "Non-invasive ventilation subgroup", # Subtitle
  # stop using quotes
  -20, # X axis inferior limit
  15, # X axis superior limit
  5 # Spacing between ticks in X axis
) 
While the darker shaded area depicts the 50% credible interval (CI), the interval bar depicts the 95% CI.

While the darker shaded area depicts the 50% credible interval (CI), the interval bar depicts the 95% CI.

xlim_inf = -2
xlim_sup = 12

p1 = posterior_difference_plot(
  
  multiple_priors_noninvasive_discharge %>% # Output from normal_approximation_multiple_priors()
    filter(type == "pessimistic"), 
  
  ## start using quotes
  "#523C84", # fill color code
  xlabel, # X axis label
  ### stop using quotes
  
  xlim_inf, # X axis inferior limit
  xlim_sup, # X axis superior limit
  2 # Spacing between ticks in X axis
) 

p2 = posterior_cumulative_plot(
  
  multiple_priors_noninvasive_discharge %>% # Output from normal_approximation_multiple_priors()
    filter(type == "pessimistic"), 
  
  xlabel, # X axis label (in quotes)
  xlim_inf, # X axis inferior limit
  xlim_sup, # X axis superior limit
  1, # Spacing between ticks in X axis
  "discharge" # Outcome (within quotes)
)
p1 + p2 + plot_annotation(
  title = "Posterior distribution: RECOVERY trial + Pessimistic prior",
  subtitle = "Non-invasive ventilation subgroup"
)
The interval bar depicts the 95% credible interval. The cumulative posterior distribution corresponds to the probabilities that the risk difference (RD) is greater than or equal to the effect size on the X‐axis.

The interval bar depicts the 95% credible interval. The cumulative posterior distribution corresponds to the probabilities that the risk difference (RD) is greater than or equal to the effect size on the X‐axis.

Invasive mechanical ventilation

Non-informative prior

## Plot!

# I will be using my own functions to standardize my plots

risk_comparison_plot(
  noninformative_recovery_invasive_discharge, # Data object

  ### start using quotes
  
  "gray50", # Color code for control group
  "#5C87C3", # Color code for other group
  "\nRisk (%)", # X axis label
  "RECOVERY trial", # Title
  "Invasive mechanical ventilation subgroup\n", # Subtitle
  
  ### stop using quotes

  10, # X axis inferior limit
  26, # X axis superior limit
  2 # Spacing between ticks in X axis
) + 
  
  # Extra function to better limits the axis in this case
  coord_cartesian(c(10, 26))
While the darker shaded area depicts the 50% credible interval (CI), the interval bar depicts the 95% CI.

While the darker shaded area depicts the 50% credible interval (CI), the interval bar depicts the 95% CI.

xlabel = "\nRisk difference (%)"
xlim_inf = -8
xlim_sup = 12

p1 = risk_difference_plot(
  noninformative_recovery_invasive_discharge, # Data object

  ## start using quotes
  "#9D95C6", # fill color code
  xlabel, # X axis label
  ### stop using quotes

  xlim_inf, # X axis inferior limit
  xlim_sup, # X axis superior limit
  4 # Spacing between ticks in X axis
) 

p2 = cumulative_risk_difference_plot(
  noninformative_recovery_invasive_discharge, # Data object
  xlabel, # X axis label (in quotes)
  xlim_inf, # X axis inferior limit
  xlim_sup, # X axis superior limit
  2, # Spacing between ticks in X axis
  "discharge" # Outcome (within quotes)
  )
p1 + p2 + plot_annotation(
  title = "Posterior distribution: RECOVERY trial + Non-informative prior",
  subtitle = "Risk difference between groups on invasive mechanical ventilation"
)
The interval bar depicts the 95% credible interval. The cumulative posterior distribution corresponds to the probabilities that the risk difference (RD) is greater than or equal to the effect size on the X‐axis.

The interval bar depicts the 95% credible interval. The cumulative posterior distribution corresponds to the probabilities that the risk difference (RD) is greater than or equal to the effect size on the X‐axis.

Evidence-based prior

forest(priors_invasive_discharge)

data_prior_posterior_plot(
  multiple_priors_invasive_discharge %>%
    filter(type == "evidence-based"), # Output from normal_approximation_multiple_priors()
  
  # start using quotes
           "#364D55", # Color for the prior
           "#9D95C6", # Color for RECOVERY
           "#DBA237", # Color for the posterior
           xlabel, # X axis label
           "Posterior distribution: RECOVERY + Evidence-based prior", # Title
           "Invasive mechanical ventilation subgroup", # Subtitle
           # stop using quotes
           -10, # X axis inferior limit
           25, # X axis superior limit
           5 # Spacing between ticks in X axis
  ) 
While the darker shaded area depicts the 50% credible interval (CI), the interval bar depicts the 95% CI.

While the darker shaded area depicts the 50% credible interval (CI), the interval bar depicts the 95% CI.

xlabel = "\nRisk difference (%)"
xlim_inf = -8
xlim_sup = 12

p1 = posterior_difference_plot(
  multiple_priors_invasive_discharge %>% # Output from normal_approximation_multiple_priors()
    filter(type == "evidence-based"), 

  ## start using quotes
  "#DBA237", # fill color code
  xlabel, # X axis label
  ### stop using quotes

  xlim_inf, # X axis inferior limit
  xlim_sup, # X axis superior limit
  4 # Spacing between ticks in X axis
) 

p2 = posterior_cumulative_plot(
  multiple_priors_invasive_discharge %>% # Output from normal_approximation_multiple_priors()
    filter(type == "evidence-based"), 
  xlabel, # X axis label (in quotes)
  xlim_inf, # X axis inferior limit
  xlim_sup, # X axis superior limit
  2, # Spacing between ticks in X axis
  "discharge" # Outcome (within quotes)
  )
p1 + p2 + plot_annotation(
  title = "Posterior distribution: RECOVERY trial + Evidence-based prior",
  subtitle = "Invasive mechanical ventilation subgroup"
)
The interval bar depicts the 95% credible interval. The cumulative posterior distribution corresponds to the probabilities that the risk difference (RD) is greater than or equal to the effect size on the X‐axis.

The interval bar depicts the 95% credible interval. The cumulative posterior distribution corresponds to the probabilities that the risk difference (RD) is greater than or equal to the effect size on the X‐axis.

Skeptical prior

xlabel = "\nRisk difference (%)"

data_prior_posterior_plot(
  
  # Output from normal_approximation_multiple_priors()
  multiple_priors_invasive_discharge %>%
    filter(type == "skeptical"), 
  
  # start using quotes
           "gray60", # Color for the prior
           "#9D95C6", # Color for RECOVERY
           "#DBA237", # Color for the posterior
           xlabel, # X axis label
           "Posterior distribution: RECOVERY trial + Skeptical prior", # Title
           "Invasive mechanical ventilation subgroup", # Subtitle
           # stop using quotes
           -15, # X axis inferior limit
           15, # X axis superior limit
           5 # Spacing between ticks in X axis
  ) 
While the darker shaded area depicts the 50% credible interval (CI), the interval bar depicts the 95% CI.

While the darker shaded area depicts the 50% credible interval (CI), the interval bar depicts the 95% CI.

xlim_inf = -6
xlim_sup = 10

p1 = posterior_difference_plot(
  
  multiple_priors_invasive_discharge %>% # Output from normal_approximation_multiple_priors()
    filter(type == "skeptical"), 

  ## start using quotes
  "gray50", # fill color code
  xlabel, # X axis label
  ### stop using quotes

  xlim_inf, # X axis inferior limit
  xlim_sup, # X axis superior limit
  2 # Spacing between ticks in X axis
) 

p2 = posterior_cumulative_plot(
  
  multiple_priors_invasive_discharge %>% # Output from normal_approximation_multiple_priors()
    filter(type == "skeptical"), 
  
  xlabel, # X axis label (in quotes)
  xlim_inf, # X axis inferior limit
  xlim_sup, # X axis superior limit
  1, # Spacing between ticks in X axis
  "discharge" # Outcome (within quotes)
  )
p1 + p2 + plot_annotation(
  title = "Posterior distribution: RECOVERY trial + Skeptical prior",
  subtitle = "Invasive mechanical ventilation subgroup"
)
The interval bar depicts the 95% credible interval. The cumulative posterior distribution corresponds to the probabilities that the risk difference (RD) is greater than or equal to the effect size on the X‐axis.

The interval bar depicts the 95% credible interval. The cumulative posterior distribution corresponds to the probabilities that the risk difference (RD) is greater than or equal to the effect size on the X‐axis.

Optimistic prior

xlabel = "\nRisk difference (%)"

data_prior_posterior_plot(
  
  # Output from normal_approximation_multiple_priors()
  multiple_priors_invasive_discharge %>%
    filter(type == "optimistic"), 
  
  # start using quotes
  "#5CA881", # Color for the prior
  "#9D95C6", # Color for RECOVERY
  "#DBA237", # Color for the posterior
  xlabel, # X axis label
  "Posterior distribution: RECOVERY trial + Optimistic prior", # Title
  "Invasive mechanical ventilation subgroup", # Subtitle
  # stop using quotes
  -10, # X axis inferior limit
  20, # X axis superior limit
  5 # Spacing between ticks in X axis
) 
While the darker shaded area depicts the 50% credible interval (CI), the interval bar depicts the 95% CI.

While the darker shaded area depicts the 50% credible interval (CI), the interval bar depicts the 95% CI.

xlim_inf = -6
xlim_sup = 12

p1 = posterior_difference_plot(
  
  multiple_priors_invasive_discharge %>% # Output from normal_approximation_multiple_priors()
    filter(type == "optimistic"), 
  
  ## start using quotes
  "#5CA881", # fill color code
  xlabel, # X axis label
  ### stop using quotes
  
  xlim_inf, # X axis inferior limit
  xlim_sup, # X axis superior limit
  2 # Spacing between ticks in X axis
) 

p2 = posterior_cumulative_plot(
  
  multiple_priors_invasive_discharge %>% # Output from normal_approximation_multiple_priors()
    filter(type == "optimistic"), 
  
  xlabel, # X axis label (in quotes)
  xlim_inf, # X axis inferior limit
  xlim_sup, # X axis superior limit
  1, # Spacing between ticks in X axis
  "discharge" # Outcome (within quotes)
)
p1 + p2 + plot_annotation(
  title = "Posterior distribution: RECOVERY trial + Optimistic prior",
  subtitle = "Invasive mechanical ventilation subgroup"
)
The interval bar depicts the 95% credible interval. The cumulative posterior distribution corresponds to the probabilities that the risk difference (RD) is greater than or equal to the effect size on the X‐axis.

The interval bar depicts the 95% credible interval. The cumulative posterior distribution corresponds to the probabilities that the risk difference (RD) is greater than or equal to the effect size on the X‐axis.

Pessimistic prior

xlabel = "\nRisk difference (%)"

data_prior_posterior_plot(
  
  # Output from normal_approximation_multiple_priors()
  multiple_priors_invasive_discharge %>%
    filter(type == "pessimistic"), 
  
  # start using quotes
  "#523C84", # Color for the prior
  "#9D95C6", # Color for RECOVERY
  "#DBA237", # Color for the posterior
  xlabel, # X axis label
  "Posterior distribution: RECOVERY trial + Pessimistic prior", # Title
  "Invasive mechanical ventilation subgroup", # Subtitle
  # stop using quotes
  -20, # X axis inferior limit
  10, # X axis superior limit
  5 # Spacing between ticks in X axis
) 
While the darker shaded area depicts the 50% credible interval (CI), the interval bar depicts the 95% CI.

While the darker shaded area depicts the 50% credible interval (CI), the interval bar depicts the 95% CI.

xlim_inf = -8
xlim_sup = 10

p1 = posterior_difference_plot(
  
  multiple_priors_invasive_discharge %>% # Output from normal_approximation_multiple_priors()
    filter(type == "pessimistic"), 
  
  ## start using quotes
  "#523C84", # fill color code
  xlabel, # X axis label
  ### stop using quotes
  
  xlim_inf, # X axis inferior limit
  xlim_sup, # X axis superior limit
  2 # Spacing between ticks in X axis
) 

p2 = posterior_cumulative_plot(
  
  multiple_priors_invasive_discharge %>% # Data object
    filter(type == "pessimistic"), 
  
  xlabel, # X axis label (in quotes)
  xlim_inf, # X axis inferior limit
  xlim_sup, # X axis superior limit
  1, # Spacing between ticks in X axis
  "discharge" # Outcome (within quotes)
)
p1 + p2 + plot_annotation(
  title = "Posterior distribution: RECOVERY trial + Pessimistic prior",
  subtitle = "Invasive mechanical ventilation subgroup"
)
The interval bar depicts the 95% credible interval. The cumulative posterior distribution corresponds to the probabilities that the risk difference (RD) is greater than or equal to the effect size on the X‐axis.

The interval bar depicts the 95% credible interval. The cumulative posterior distribution corresponds to the probabilities that the risk difference (RD) is greater than or equal to the effect size on the X‐axis.